home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / gcc263-objc020.lha / gnu / README-2.6.3 < prev   
Text File  |  1994-12-11  |  34KB  |  872 lines

  1. Short: gcc v2.6.3 - C/C++/ObjC Compiler set for AmigaDOS
  2. Type: dev/gcc
  3. Uploader: phb@colombo.telesys-innov.fr
  4. Author: phb@colombo.telesys-innov.fr
  5.  
  6. This directory contains the 2.6.3 release of the GNU C compiler.
  7.  
  8. The GNU C compiler is free software.  See the file COPYING for copying
  9. permission.
  10.  
  11. ===============
  12. How to get help
  13. ===============
  14.  
  15. There's an amiga-gcc mailing list running in Finland, read README-LIST file.
  16. This is the preferred place to ask for help since I'm on this list and
  17. every GCC developers also, libnix & ixemul authors, etc...
  18.  
  19. Short: send an email to listserv@lists.funet.fi, and put in body:
  20.     subscribe amiga-gcc-port your_first_name your_last_name
  21.  
  22. Otherwise you can contact me at:
  23.  
  24.     Philippe BRAND
  25.     Fidonet: Ramses The Amiga Flying BBS 2:320/104.21
  26.     Email:   phb@colombo.telesys-innov.fr (ONLY for personal email).
  27.     Ftp:     colombo.telesys-innov.fr:/pub/amigados-gnu
  28.              or /pub/incoming/uploads for uploads.
  29.  
  30. Note: I'll forward any question to this mailing-list, but please use it
  31. directly, except when you send files, in this case send them to my ftp site.
  32.  
  33. Note2: ftp.funet.fi mirrors my amigados-gnu tree. Using ftp.funet.fi is
  34. preferable as they have much more bandwidth.
  35.  
  36. ============
  37. Requirements
  38. ============
  39.  
  40. - Systems:
  41. Any Amiga (ranging from A1000 up to A4000/40, including CD-32 & SX-1) will
  42. run amigados-gnu utilities.
  43.  
  44. - Memory:
  45. A minimum of 4MB free memory is needed in order to compile small/medium
  46. projects.
  47. More memory will be needed for large projects, such as recompiling gcc
  48. itself.
  49. Gigamem is known to work with GCC so *maybe* less memory will work. But in this
  50. case, you'll need an MMU equiped amiga (A3000,A4000/40, etc...).
  51. VMM40 (Public Domain Virtual memory manager) is also known to work with GCC.
  52.  
  53. - OS:
  54. Starting from this release, 1.3 systems are not longer supported.
  55. Gcc runs fine on all other systems, starting from 2.04 up to 3.1 (40.68).
  56.  
  57. - Disk Space;
  58. An installation of gcc requires the use of a hard disk. Approximately 10MB is
  59. required at present to install the compiler and utilities required to use it.
  60. In addition 3MB is required for the Commodore Developer Kit, which is required
  61. to be able to compile AmigaDOS specific programs. This kit is available direct
  62. from Commodore-Amiga.
  63.  
  64. ==========================
  65. What's new in this release
  66. ==========================
  67.  
  68. 2.6.3
  69.  
  70. - Read FSF NEWS-2.6.1 file included.
  71. - As always, generic bugs fixed (see Changelog in gcc sources for details).
  72. - q_anote package replaced by FSF listing shell script, need awk.
  73. - new as/ld/size/nm/ranlib, made by Raphael Luebbert
  74. - new environnement variables GCCPRIORITY and GCCSTACK, see below.
  75. - all programs recompiled using 2.6.3 compiler.
  76. - mit2mot & mot2mit, convert asm syntax between Motorala and MIT syntaxes.
  77. - all programs hold AmigaDOS compatible $VER string.
  78.  
  79. =================================
  80. What was new in previous releases
  81. =================================
  82.  
  83. 2.6.2
  84.  
  85. - internal release only.
  86.  
  87. 2.6.1
  88.  
  89. - Read FSF NEWS-2.6.1 file included.
  90. - As always, generic bugs fixed (see Changelog in gcc sources for details).
  91. - new option -priority in gcc allowing process priority setting.
  92. - new specs file, inlines/protos and libamiga done by Gunther Nikl. See note
  93.   below.
  94. - new libnix version by Matthias Fleischer & Gunther Nikl.
  95. - new ixemul version by Raphael Luebbert.
  96. - stripc program to strip all uneccessary stuff from headers by Chris Metcalf,
  97.   submitted by Lars Hecking.
  98. - q_anote, anotate assembly files mixing C source code, submitted by Walter
  99.   Harms (Walter.Harms@arbi.informatik.uni-oldenburg.de), written by 
  100.   Mike Albaugh (albaugh@agames.com). See note below.
  101. - new assembler, as-2.5, using new BFD (Binary File Descriptor), made by
  102.   Raphael Luebbert.
  103.  
  104. 2.6.0
  105.  
  106. - Read FSF NEWS-2.6.0 file included.
  107. - Extensive internal compiler bugs fixed (see ChangeLog in gcc sources for
  108.   details), tons of bugs fixed for C++ support.
  109. - ld changed (see note for ld below).
  110. - new ixemul.library, with optimized versions for accelerated Amigas, see
  111.   README-ixemul & ixemul.guide for more informations.
  112. - new C library (libnix) disabling use of ixemul.library for generated
  113.   programs (best use for AmigaDOS specific programs). Full ANSI compliant, see
  114.   README-libnix & libnix.guide for more informations.
  115. - revised inline headers in accordance with new ixemul.library.
  116. - libamiga.a is now distributed with gcc-2.6.1.
  117. - as v2.3 is included, along with a macro-assembler (gasp).
  118. - stderrfix.o (see below) patch applied.
  119. - Upgrade to libg++-2.6.
  120. - Gcc now supports $VER string for AmigaDOS version compatibility.
  121.  
  122. 2.5.8
  123.  
  124. - Read FSF NEWS-2.5.8 file included.
  125. - ld behavior over symbols changed (see note below).
  126. - added flavors so that linker will take appropriate libraries according to
  127.   gcc options (m68020 libraries/baserel libraries, etc...).
  128. - gpc (GNU-Pascal) v1.03 added.
  129. - all utilities recompiled with gcc-2.5.8.
  130. - plain 68000 and 68020+68881 versions of all binaries available.
  131. - More internal compiler bugs fixed (see ChangeLog in gcc sources for details),
  132.   some for C++ support.
  133. - GCC-Install script fixed by Claus Deckhut (to be used with full distrib).
  134. - Upgrade to libg++-2.5.3.
  135. - trace.c updated by J. Hoehle to avoid buffer overflows.
  136.  
  137. 2.5.7:
  138.  
  139. - Read FSF NEWS file included.
  140. - More internal compiler bugs fixed (see ChangeLog in gcc sources for details),
  141.   a lot for C++ support.
  142. - Fred Fish seems to have finally found an annoying bug which prevented
  143.   to compile a resident version of GCC, or to compile resident programs. But
  144.   don't try it anyway 'cause there's still lack of library support as for now.
  145. - Man command now works, this one was my fault (well in fact like others ;-),
  146.   fix done by Tom Haiko.
  147. - Infoview works also, it was an internal path problem.
  148. - libamy.a HAS TO BE RENAMED to libamiga.a because new ld won't find libamy.a
  149. - upgrade to new C++ library v2.5.1.
  150.  
  151. =======
  152. Authors
  153. =======
  154.  
  155. Gcc v2.2.2 port:   Markus Wild
  156. Gcc v2.3.3 port:   Markus Wild
  157. Gcc v2.4.5 port:   Philippe Brand, Lars Hecking, Fred Fish
  158. Gcc v2.5.0 and up: Philippe Brand, Fred Fish, Leonard Norrgard 
  159.  
  160. Ixemul.library:    Markus Wild, Leonard Norrgard, Raphel Luebbert,
  161.                    Stephan Isthesin.
  162. Libnix:            Matthias Fleischer, Gunther Nikl
  163.  
  164. Thanks to all amiga-gcc-port mailing-list users for their reports and support
  165. for a better amigados-gcc and documentation.
  166.  
  167. =======
  168. Sources
  169. =======
  170.  
  171. These archives should contain everything necessary to get you going, they
  172. don't include sources for all tools (have a look at end of paragraph).
  173.  
  174. As stated by Richard Stallman of the FSF:
  175.  
  176. "The GPL says that any distribution of binaries must contain either the
  177. source code or a written offer to supply source code (see the GPL for
  178. details of what is required)."
  179.  
  180. If you're interested in the sources required to rebuild gcc, get the
  181. gcc263-src.lha, which hold sources for gcc. Those archives should be stored
  182. either the same ftp site you got this binary distribution from (if they're
  183. not, tell the manager of that ftp site, as this is a requirement of the
  184. GNU Copyright LICENSE), either at ftp.gnu.ai.mit.edu:/pub/gnu, either on
  185. Ramses BBS (phone numbers listed below).
  186.  
  187. If you have those archives, you can skip to next paragraph. If you have
  188. original FSF sources, you'll have to apply the gcc patch-file in src-patches/,
  189. and configure for `amigados'. Please note that you should have at least 40MB
  190. left or your HD and 8MB of memory minimum in order to rebuild gcc up to stage3.
  191. An accelerated Amiga is welcome, as it took me 4,5 hours to generate a single
  192. pass. So 3 passes makes 4,5 x 3 = 13,5 hours.
  193.  
  194. Sources for other tools only included as binaries are available separately
  195. in self-contained archives, usually having their name into the archive-name.
  196.  
  197. File                What
  198.  
  199. gcc263-src.lha            C/C++/ObjC compiler sources & diff file
  200. libnix-0.6.lha            libnix sources and binaries
  201. ixemul-40.4-src.lha        ixemul sources and libraries
  202. binutils-1.8.x-src.lha        Sources for ld
  203. binutils-2.5.2-src.lha        Sources for ar/ranlib & diff file
  204. gdbm-1.7.3-src.lha        Sources for gdbm & diff file
  205. make-3.71-src.lha        make sources & diff file
  206. patch-2.1-src.lha        patch sources, needed to apply diff files
  207. sed-2.05-src.lha        sed sources & diff file
  208. gawk-2.15.5-src.lha        GNU awk sources & diff file
  209. diffutils-2.7-src.lha        diff utility sources & diff file
  210. fileutils-3.11-src.lha        file utilities sources & diff file
  211. sh-utils-1.12-src.lha        shell utilities sources & diff file
  212. textutils-1.11-src.lha        text utilities sources & diff file
  213. findutils-4.1-src.lha        find sources & diff file
  214. grep-2.0-src.lha        grep sources & diff file
  215. bison-1.22-src.lha        bison (yacc replacement) sources & diff file
  216. flex-2.4.7-src.lha        flex (lex replacement) sources & diff file
  217. texinfo-3.1-src.lha        texinfo (includes makeinfo) sources & diff file
  218. gzip-1.2.4-src.lha        gzip sources & diff file
  219. tar-1.11.2-src.lha        gtar sources & diff file
  220. cpio-2.3-src.lha        cpio sources & diff file
  221. gdbm-1.7.3-src.lha        database manip. library sources & diff file
  222. termcap-1.2-src.lha        termcap library sources & diff file
  223. libm-5.6-src.lha        BSD mathematic library sources & diff file
  224.  
  225.  
  226. NOTE:
  227. All sources archives are amiga ready, and amiga specific diff file located
  228. in 'amiga' directory. To recompile a tool, just run a 'configure amigados'
  229. then a 'make'.
  230. Exceptions are libnix, ixemul which have their own archives, both binary &
  231. sources.  On Aminet sites, libnix & ixemul in /pub/amiga/dev/gcc.
  232.  
  233. =====
  234. Where
  235. =====
  236.  
  237. **** All GNU sources & binaries are available on:
  238.  
  239. - ftp.telesys-innov.fr, primary Amiga-GNU FTP site, and its mirror ftp.funet.fi
  240.   which is MUCH faster than my own site. Please use it at first choice.
  241.     in /pub/amigados-gnu
  242.  
  243. - Aminet sites (wuarchive.wustl.edu and mirrors such as ftp.luth.se)
  244.     in /pub/amiga/dev/gcc
  245.  
  246. - Ramses The Amiga Flying BBS  +33-1-60037015  HST Dual v32 terbo 4800-21600
  247.                                +33-1-60037713  SupraFax v32bis    4800-14400
  248.                                +33-1-60037716  Tornado v22bis     1200-2400
  249.     in Topic "Development", Area "Gcc"
  250.  
  251. - FreshFish CDs from Fred Fish           Amiga Library Services
  252.     in :GNU/bin, :GNU/src, :GNU/lib dirs.  610 N. Alma School Road, Suite 18
  253.                        Chandler, AZ 85224-3687
  254.                        USA
  255.                        Fax: (602) 917-0917 (no voice phone
  256.                        orders, FAX only)
  257.  
  258. **** GNU source code is available on:
  259.  
  260. - same FTP site you've taken these archives
  261.  
  262. - gnu.prep.ai.mit.edu 18.71.0.38
  263.     in /pub/gnu
  264.  
  265. - Ramses The Amiga Flying BBS
  266.     in Topic "AmigaUnix/Unix/Linux/NetBSD", Area "Gnu Source Code"
  267.  
  268. - FreshFish from Fred Fish
  269.     in :GNU/src
  270.  
  271. ======
  272. Layout
  273. ======
  274.  
  275. Gcc-2.6.3 is split up into 15 archives:
  276.  
  277. gcc263-readme.lha    holds readmes files (include installation notes).
  278. gcc263-base.lha         basic gcc distribution, hold necessary files.
  279. gcc263-inclib.lha    headers and libraries.
  280. gcc263-c.lha        C compiler.
  281. gcc263-c-020.lha    68020+68881 version of C compiler.
  282. gcc263-c++.lha        C++ compiler, headers and libraries.
  283. gcc263-c++-020.lha    68020+68881 versions of C++ compiler.
  284. gcc263-objc.lha        Objective-C compiler, header and libraries.
  285. gcc263-objc-020.lha    68020+68881 versions of Objective-C compiler.
  286. gcc263-doc.lha        Gcc AmigaGuide(tm) documents & manpages.
  287. gcc263-utils.lha    Useful utilities needed for development.
  288. gcc263-utilsdoc.lha    Utilities documentation (guide & manpages).
  289. gcc263-texi.lha        All Texinfo documents.
  290. gcc263-diffs.lha    Diff files for all binaries.
  291. gcc263-src.lha        Source for gcc-2.6.3 plus diff file.
  292.  
  293. Name            What                    Where    
  294. ----            ----                    -----
  295.  
  296. COPYING            GNU LICENSE, read!!            All archives
  297. COPYING.LIB        GNU LIBRARY LICENSE, read!!        All archives
  298. README-2.6.3        this file                All archives
  299. NEWS-2.6.3        What's new in gcc-2.6.3            gcc263-base
  300. Installer        Commodore installer utility        gcc263-base
  301. GCC-Install        Installer script to configure gcc    All archives
  302. envarc/            global environment variables you should
  303.             have set when using this programming    gcc263-base
  304.             environment
  305. include/        non-amiga specific C/C++ headers    gcc263-inclib
  306. os-include/proto    amiga specific protos headers.        gcc263-inclib
  307. os-include/inline    amiga specific inline C headers. Add    gcc263-inclib
  308.             Commodore headers!!        
  309. os-lib/            amiga specific libraries        gcc263-base
  310. guide/            Docs in AmigaGuide(tm) format        gcc263-doc
  311. man/            this is the root for tons of man pages    gcc263-doc
  312. bin/            this is /bin, and contains all         gcc263-c
  313.             binaries of this distribution that    gcc263-c++
  314.             are meant to be directly invoked by    gcc263-utils
  315.             the user (contrary to the executables
  316.                  in lib/gcc-lib/, that are meant to be
  317.             invoked by a driver program like gcc)
  318. lib/            normal (not base relatives) libraries    gcc263-inclib
  319. lib/libm020/        normal 68020 libraries            gcc263-inclib
  320. lib/libb/        base relatives libraries        gcc263-inclib
  321. lib/libb/libm020/    base relatives using 68020 libraries    gcc263-inclib
  322. lib/libnix/        Non-ixemul libraries            gcc263-inclib
  323. lib/libm020/libnix/    Non-ixemul 68020 libraries        gcc263-inclib
  324. lib/libb/libnix/    Non-ixemul base relatives libraries    gcc263-inclib
  325. lib/libb/libm020/libnix    Non-ixemul base relatives 68020 libs    gcc263-inclib
  326. lib/gcc-lib/        home of compilers called by gcc        gcc263-c
  327.                                 gcc263-c++
  328.                                 gcc263-objc
  329. ixpipe/            a pipe handler needed by the library    gcc263-base
  330. libs/            ixemul.library                gcc263-base
  331. rexx/            ARexx wrappers for gcc and g++        gcc263-base
  332. src-patches/        source patches                gcc263-diffs
  333. geninline/        Perl scripts to generate inline headers    gcc263-inclib
  334.             and -lamy glue
  335.  
  336. ==============
  337. Inline-Headers
  338. ==============
  339.  
  340. Since I'm not able to redistribute amiga header files, you will have to get
  341. them directly from Commodore, unless you're an official registrated Amiga
  342. developer. In order to generate inline-headers, follow these steps (provided
  343. amiga headers and fd files are in os-include). You don't have to generate them
  344. if you use OS3.1 (40.13 headers).
  345.  
  346. 1) First method:
  347.  
  348. CLI> stack 100000
  349. CLI> Assign INCLUDE: GCC:os-include
  350. CLI> Assign FD: INCLUDE:fd
  351. CLI> Makedir INCLUDE:inline
  352. CLI> cd USR:bin/geninline
  353. CLI> gen31
  354.  
  355. This will create all inline-headers. If you have 2.0 headers, use gen20
  356. instead, if you have 3.0, use gen30, if you have 6.4, send it to me ;-)
  357.  
  358. NOTE: perl scripts do not handle correctly AmigaDOS include files, which
  359. seems to mean they are somewhat broken. If someone could work on this...
  360.  
  361. 2) Second method:
  362.  
  363. Use fd2inline, which you can find on Aminet in dev/gcc.
  364.  
  365. ===============
  366. Amiga Libraries
  367. ===============
  368.  
  369. Starting from this release an AmigaDOS compliant library is provided,
  370. thanks to libnix authors (Matthias Fleischer and Gunther Nikl).
  371.  
  372. Anyway if you want to rebuild one, there are two methods:
  373.  
  374. 1) Using hunk2gcc; the AmigaDOS object converter made by Markus Wild. To
  375. achieve this, simply grab a copy of latest amiga.lib (from Commodore
  376. Development Kit) and make a new directory where you want your converted
  377. object files to go, cd into it, and enter
  378.  
  379.   hunk2gcc amiga.lib [..further libs if you like..]
  380.  
  381. This generates an a.out object file for every program unit present in the
  382. hunk file (in this case, from amiga.lib).
  383.  
  384. As the final step convert all those files into an a.out style library by
  385. issuing:
  386.  
  387.   ar qc libamiga.a obj.*
  388.   ranlib libamiga.a
  389.  
  390. The ranlib run builds a symbol table in the archive, and makes accesses to
  391. the library much faster.
  392.  
  393. 2) Creating a libamiga.a library with libnix is fairly easy, but takes some
  394. time. Just uncompress sources.lha from libnix distribution and run a
  395. 'make libamiga.a'.
  396.  
  397. NOTE:
  398.  
  399. As long as you make no AmigaDOs specific calls, you can create a dummy library
  400. using:
  401.  
  402.   cat "int dummy;" >dummy.c
  403.   gcc -c dummy.c
  404.   ar crv libamiga.a dummy.o
  405.   mv libamiga.a gcc:lib
  406.  
  407. A small libamiga.a (dummy) is also provided with libnix.
  408.  
  409. ============
  410. Installation
  411. ============
  412.  
  413. 1) If this is your first installation of GCC, follow these steps;
  414.  
  415. - You need first to create a directory gnu on your hard-disk and unarchive
  416. first part:
  417.     CLI> cd place_with_lot_of_space
  418.     CLI> makedir gnu
  419.     CLI> lha x gcc263-base.lha
  420.  
  421. - Now you have to append gnu/s/user-startup to your s:user-startup file
  422. (replace Devel:GNU by your own gnu path). Execute it in order to get new
  423. assigns:
  424.     CLI> execute gnu/s/user-startup
  425.  
  426. - Copy gnu/envarc to ENVARC:
  427.     CLI> copy gnu/envarc/#? ENVARC:
  428.  
  429. - C-compiler is needed so unarchive C compiler part (Users with
  430. accelerated amigas can unarchive gcc263-c-020 part instead) :
  431.     CLI> lha x gcc263-c.lha  (or gcc263-c-020)
  432.  
  433. - If you want to have Gcc documentation on-line, unarchive doc part:
  434.     CLI> lha x gcc263-doc.lha
  435.  
  436. - If you want to do C++, unarchive C++ part (Users with
  437. accelerated amigas can unarchive gcc263-c++-020 part instead) :
  438.     CLI> lha x gcc263-c++.lha (or gcc263-c++-020)
  439. Please not that 68020+68881 versions have '.020' extension in GNU:bin.
  440.  
  441. - If you want to do Objective-C, unarchive Objective-C part (Users with
  442. accelerated amigas can
  443.  unarchive gcc263-objc-020 part instead) :
  444.     CLI> lha x gcc263-objc.lha (or gcc263-objc-020)
  445.  
  446. - If you want additional utilities (recommended for Unix compatibility),
  447. unarchive utils part:
  448.     CLI> lha x gcc263-utils.lha
  449.  
  450. - If you want all utilities documentation no-line, unarchive utils-doc
  451. part:
  452.     CLI> lha x gcc263-utilsdoc.lha
  453.  
  454. - Because some programs are normally link to others, please run script:
  455.     CLI> sh /gnu/s/restorelinks
  456.   Or if you don't want to use makelink but rather copy file, run script:
  457.     CLI> sh /gnu/s/restorelinks copy
  458.  
  459. - If you want to rebuild all distribution, you'll have to unarchive
  460. diff part:
  461.     CLI> lha x gcc263-diffs.lha
  462.  
  463. - If you want to build Postscipt files for Gcc documention, unarchive
  464. texinfo part:
  465.     CLI> lha x gcc263-texi.lha
  466.  
  467. - Now skip to next paragraph and happy compiling!
  468.  
  469. 2) If you "upgrade" your gcc environment from v2.5.x, just unarchive first
  470.    2 archives as it would normally include all what you need (thus gcc263-base
  471.    and gcc263-c). Make sure you delete your previous ixemul.library
  472.    wherever it is (usually LIBS:).
  473.  
  474. NOTE:  new version of ixemul.library is provided, make sure you don't have
  475. another copy somewhere which may conflict with gcc.
  476.      
  477. =============================
  478. Your first C program with gcc
  479. =============================
  480.  
  481. What about a nice Hello World ?
  482.  
  483.     #include <stdio.h>
  484.  
  485.     main()
  486.     {
  487.       printf("Hello World!\n");
  488.     }
  489.         
  490. This was pretty simple ;-) Now we have to compile it.     
  491. There's a lot of options in gcc but simplest way to compile this would be:
  492.  
  493. CLI> gcc -o hello hello.c
  494.  
  495. Simple ?
  496.  
  497. Here's more options.
  498.  
  499. Target processor for Motorola family:
  500. You can compile plain 68000 code, 68020, 68030, 68040, 68881 (have a look at
  501. GCC documentation, either in info or AmigaGuide format, chapter Invoking Gcc/
  502. SubModel Options/M680X0 Options for Motorola specific compilation flags).
  503.  
  504. CLI> gcc -m68020 -m68881 -o hello hello.c
  505.  
  506. This will compile your programs using 68020 code and direct calls to
  507. math-processor, and will link with accelerated libraries, located in
  508. GCC:lib/lib020.
  509.  
  510. Optimization:
  511. Either you don't want optimization, or you can provide -O, which will 
  512. optimize your code, or if you really want top optimization, use -O2 flag (for
  513. more discussion about optimization, read info or AmigaGuide doc chapter
  514. Invoking Gcc/Optimize Options). There's now even a -O3 optimization option,
  515. which will go even further.
  516.  
  517. CLI> gcc -O2 -o hello hello.c
  518.  
  519. You'll never have a "Hello World" program running so fast ;-)
  520.  
  521. Code generation:
  522. Perhaps you want to generate resident programs.
  523. Flag is -resident, at compile and link stage.
  524.  
  525. CLI> gcc -resident -o hello hello.c
  526.  
  527. Of course you can mix all options, resulting in:
  528.  
  529. CLI> gcc -O2 -m68020 -m68881 -resident -o hello hello.c
  530.  
  531. This will make a 68020+68881 executable highly optimized and resident.
  532.  
  533. IMPORTANT:
  534. If you only use AmigaDOS functions or you don't want to use ixemul for
  535. philosophical reasons, you can get rid of ixemul.library with:
  536.  
  537. CLI> gcc -noixemul -o foobar foobar.c
  538.  
  539. provided you have libnix distribution (included with 2.6.3 distribution).
  540.  
  541. ================
  542. Ixemul vs Libnix
  543. ================
  544.  
  545. Starting with 2.6.1 version of amigados-gcc, two C libraries are provided.
  546.  
  547. First one is using ixemul.library Amiga shared-library at run-time. This
  548. library makes it possible to easily convert Unix(tm) programs to AmigaDOS,
  549. and made for example possible gcc on AmigaDOS. Have a look at ixemul.guide
  550. for further informations.
  551.  
  552. Second one is an ANSI-C compliant library which is better suited for
  553. AmigaDOS specific development, thus not using any Unix specific routines.
  554.  
  555. Note that you can develop AmigaDOS specific programs with ixemul.library,
  556. but at the cost of an extra 200KB memory taken by shared library.
  557.  
  558. ===============================
  559. Redirection with ixemul.library
  560. ===============================
  561.  
  562. A common problem seen with amigados-gcc is bad redirection to sderr.
  563.  
  564. The fact is that ixemul.library takes stderr from the pr_CES field
  565. in the process structure. The field was added in 2.0. If the field
  566. is not set, then ixemul uses stdout, instead. The trouble is that this
  567. field must be set by the shell, and the only shell that does so is
  568. WShell!
  569.  
  570. The rationale behind ixemul.library working this way is that
  571. "run <NIL: >NIL: cmd" will detach your process from the terminal, so
  572. that you can close the initial CLI window after startup.
  573.  
  574. In any case, there is a workaround for the problem that was posted to the
  575. list a while back: compile your main program using the -Dmain=mymain
  576. option, then link with stderrfix.o to provide the actual main that will
  577. do the magic that creates an stderr stream that is different from
  578. stdout. Along with the C version a C++ version is included and was used to
  579. compile groff.
  580.  
  581. Thanks to Kriton Kyrimis for this explanation and patch.
  582. stderr fixes can be found in GNU:stderrfix (srcs-) and GNU:lib (.o files).
  583.  
  584. =====
  585. ARexx
  586. =====
  587.  
  588. The provided ARexx scripts have been contributed by Loren J. Rittle.
  589. If you like ARexx, they're an alternate way of calling gcc. They 
  590. automatically make sure you're using a large enough stack setting, and 
  591. enable you to compile C++ programs with less obscure options. This 
  592. approach is furthermore useful if you're not able to use the g++ /bin/sh
  593. script.
  594.  
  595. ===============
  596. gcc versus gccv
  597. ===============
  598.  
  599. gccv stands for a gcc using vfork() to spawn a new process, and then calling
  600. the new execve() function in ixemul.library to call its subcompilers. Gcc
  601. continues to using the more system friendly RunCommand() function in
  602. dos.library to start subcompilers. Gccv has the advantage of being able to
  603. work with interprocess pipes, thus (provided you have the memory ;-)), you're
  604. able to do
  605.  
  606.     gccv -pipe your_program.c
  607.  
  608. causing the preprocessor (cpp), the C-compiler (cc1) and the assembler (as)
  609. to run at the same time, passing intermediate files thru internal pipes 
  610. instead of using temporary files.
  611.  
  612. As long as you don't want that feature (ok, playing with certain make tools
  613. also requires gccv) you're safe using gcc.
  614.  
  615. ==========
  616. stack size
  617. ==========
  618.  
  619. You need to have a 50.000 stack size in order to compile with GCC. This should
  620. be enough for most projects. Note than while recompiling gcc with itself it
  621. has taken more than 300KB stack. Stack can grow due to source complexity.
  622. Don't be afraid of it.
  623.  
  624. To set the stack size, see the AmigaDOS Command 'stack'. 
  625.  
  626. To use ar and/or ranlib, 50KB is the minimum acceptable. You should have a
  627. much larger stack, if you use larger libraries.
  628.  
  629. Starting with 2.6.3 a new environnement variable, GCCSTACK, enables gcc to
  630. read this variable and set stack upon startup. Thus now no need to set stack
  631. to huge values, only gcc/ld/cpp/cc1#? will automatically set new stack,
  632. according to GCCSTACK variable.
  633.  
  634. Simply commit a: 
  635.     setenv GCCSTACK value
  636. to set gcc stack to value.
  637.  
  638. Benefits: huge memory savings.
  639.  
  640. ========
  641. priority
  642. ========
  643.  
  644. Starting also with 2.6.3 a new environnement variable, GCCPRIORITY, let you
  645. specify a default process priority for GNU compiler. Setting it to -1 enable
  646. your Amiga to do something else while compiling :-)
  647.  
  648. ===========
  649. C++ headers
  650. ===========
  651.  
  652. With AmigaDOS it makes no difference whether a name has capital or lower-case
  653. letters in names when finding files (i.e. it is case insensitive), you'll 
  654. certainly run into problems with some headers, including String.h and normal
  655. string.h. My suggestion for now is to add to C++ "faulty" header filename an
  656. "_" in front of it, thus String.h would become _String.h. Sorry for
  657. inconvenience. (thanks to Dirk Nehring for reminding me this anoying
  658. "feature").
  659.  
  660. =======
  661. Patches
  662. =======
  663.  
  664. Includes:
  665.  
  666.     Jörg Höhle
  667. hoehle@inf-wiss.uni-konstanz.de
  668.  
  669. There is a conflict between the Amiga and the UNIX definition of the
  670. timeval structure.  Markus Wild proposed in gcc233 to patch the Amiga
  671. devices/timer.h file so that it loads the UNIX sys/time.h file (and
  672. thus tons of other files) (see os-include/devices/timer.mwild.path). I
  673. suggest that sys/time.h and devices/timer.h be modified to detect each
  674. other and use whichever structure was declared first (see
  675. os-include/devices/timer.jch.patch). The supplied include/sys/time.h
  676. file works this way.  You can apply the patches with the program patch
  677. or by hand. The original devices/timer.h file is copyrighted by
  678. Commodore-Amiga and not included, but here is the patch:
  679.  
  680. + #ifndef _SYS_TIME_H_
  681. + /* Use whatever was included first, standard (sys/time.h) or Amiga
  682. +  * includes (jch). */
  683.   struct timeval {
  684.       ULONG tv_secs;
  685.       ULONG tv_micro;
  686.   };
  687. + #else
  688. + #define tv_secs  tv_sec
  689. + #define tv_micro tv_usec
  690. + #endif
  691.  
  692. The sys/types.h defined BPTR causing conflicts with Amiga includes. I
  693. removed the BPTR definition from sys/types.h and sys/proc.h. In
  694. gcc233, there was no such definition either.
  695.  
  696. I moved the ixemul.h file from include/ to the ixemlib/library/
  697. directory. The ixemlib/ directory could contain the ixemul.library
  698. sources. In the ixemul source tree, ixemul.h is found in the library/
  699. directory.  Furthermore I patched it so that it is now able to compile
  700. a working ixconfig. It was broken (because of the broken ixemul.h) in
  701. gcc252/3/4.  It previously worked in gcc233 but didn't provide the -e
  702. option. The ixemlib/library/version.h is an empty fake. I don't have a
  703. newer ixemul.h file.
  704.  
  705. There's yet another minor patch I'd like to suggest:
  706. *** include/stdlib.h.orig    Mon Aug 10 15:28:54 1992
  707. --- include/stdlib.h    Fri Dec 09 17:12:38 1993
  708. ***************
  709. *** 72,76 ****
  710. --- 72,80 ----
  711.   void    *calloc __P((size_t, size_t));
  712.   div_t     div __P((int, int));
  713. + #if 0
  714.   void volatile exit __P((int));
  715. + #else /* new ANSI-C interpretation */
  716. + typedef void exit_t __P((int)); volatile exit_t exit;
  717. + #endif
  718.   void     free __P((void *));
  719.   char    *getenv __P((const char *));
  720.  
  721. ===============
  722. Ld (GNU linker)
  723. ===============
  724.  
  725. Starting from 2.5.8 release, ld behavior over symbols has changed. Default is
  726. now to strip all symbols from generated executable ONLY if environment variable
  727. LDSTRIP is set (to whatever you want). Otherwise, '-s' flag will strip symbols,
  728. as usual.
  729. Also packing of uninitialized data will be done automatically if LDSHORTDATA is
  730. set (to whatever you want).
  731. Ld also knows about -chip and -fast keywords, gcc will soon handle them
  732. directly.
  733. Ld is using now flavors, which are generated depending on gcc flags:
  734.  
  735. Gcc option    Flavor passed to ld
  736. -m68020        -fl libm020
  737. -noixemul    -fl libnix
  738. -resident    -fl libb
  739.  
  740. Thus ld when searching for libraries, add to search library path those flavors,
  741. in alphabetical order. Normal search path is /gnu/lib, and if for example you
  742. want to compile using -m68020 -noixemul ld will look for libgcc.a in:
  743.     /gnu/lib/libm020/libnix
  744. first, then will reduce flavors, one by one, if it can't find required library
  745. in flavor's expanded path. This means that it will try to find libgcc.a in:
  746.     /gnu/lib/libm020
  747. and in  /gnu/lib/. because libgcc.a exists in /gnu/lib/libm020, ld will take
  748. this one.
  749.  
  750. There is as for now 8 possibilities:
  751.  
  752.     Flavors        Search path
  753. libb libm020 libnix
  754.  0      0      0    /gnu/lib/            normal
  755.  0      0      1    /gnu/lib/libnix/        non-ixemul
  756.  0      1      0    /gnu/lib/libm020/        normal 68020
  757.  0      1      1    /gnu/lib/libm020/libnix/    non-ixemul 68020
  758.  1      0      0    /gnu/lib/libb/            baserel
  759.  1      0      1    /gnu/lib/libb/libnix/        baserel non-ixemul
  760.  1      1      0    /gnu/lib/libb/libm020/        baserel 68020
  761.  1      1      1    /gnu/lib/libb/libm020/libnix/    baserel 68020 non-ix
  762.  
  763. Using this approach makes adding flavors pretty easily, if someone wants for
  764. example to add 68881 libraries, a new flavor will hve to be created, libm881,
  765. and thus maximum level flavor search path would be:
  766. /gnu/lib/libb/libm020/libm881/libnix, which can be translated in english as:
  767. "I want a base-relative library compiled using Motorola 68020 and coprocessor
  768. 68881, not using ixemul.library".
  769.  
  770. =====================
  771. gcc and its "pragmas"
  772. =====================
  773.  
  774. From Gunther Nikl:
  775.  
  776. Accessing operating-system functions on the amiga requires to pass arguments
  777. in specific processor registers. C, however, uses a different calling convention:
  778. it pushes all arguments in reverse order onto the stack, calls the function and
  779. finally removes the arguments from the stack by simply correcting the stack pointer.
  780. One solution to interface C and the calling convention for the system-functions are
  781. so called "glue"-functions that convert arguments passed on the stack into the
  782. os-function convention. These glue routines are located for all system libraries
  783. in a link library named libamiga.a. Obviously this method is inefficient. Most
  784. amiga c-compilers have the capability of in-line calls to os functions using
  785. a c language extension "#pragma". The format of a pragma statement and file names
  786. differ from compiler to compiler. gcc supports in-line calls too but not with
  787. pragmas. the gcc solution is based on the fact that gcc is able to integrate small
  788. functions into the caller. This method is known from c++ as "inlining". Thus
  789. functions that are declared "inline" (peferable in conjunction with the keyword
  790. static or extern but see the next chapter) get integrated. As you can see writing
  791. programs that compile with several compilers and use its capability of making
  792. in-line calls to libraries is a tricky thing.
  793.  
  794. To get programs more portable between amiga c-compilers a new set of include files
  795. would be helpful that hide the diffrent methods for in-line calls from the user.
  796. These files are located in a drawer called proto eg. "proto/exec.h". Instead of
  797. writing (only an example!):
  798.  
  799.     #include <clib/exec_protos.h>
  800.     #ifdef __GNUC__
  801.     #include <inline/exec.h>
  802.     #endif
  803.  
  804. now the following should be used:
  805.  
  806.     #include <proto/exec.h>
  807.  
  808. to achieve the same result! Nice, isn't it? The general rule for the all files is:
  809.  
  810.     #include <proto/xxx.h>
  811.  
  812. with "xxx" replaced with the first part of a clib proto-headers name eg.
  813. "exec_protos.h" becomes "exec.h"
  814.  
  815. In general each file first includes its function prototype header then the compiler
  816. specific "pragma" header and finally declares the library base extern. The gcc files
  817. are in the following format:
  818.  
  819.     (1) include some C= headers to prevent errors with gcc
  820.     (2) include the function prototypes from the clib drawer
  821.     (3) include the inline header if this is not disabled and if optimizing
  822.     (4) declare the library base extern if its not disabled
  823.  
  824. Step 3 will only be executed if gcc is optimizing. Otherwise the compiler won't
  825. integrate any function. Even when optimizing it could be not desired to include
  826. the inline header because it requires some amount of memory and the compile time
  827. enlarges significantly. Therefore step 3 can be disabled with:
  828.  
  829.     - a define on the commandline "-D__NOINLINES__"
  830.             or
  831.     - a define before the proto headers are included "#define __NOINLINES__"
  832.  
  833. Declaring the library base as an external variable can disabled with a define in
  834. the same way. The define is called "__NOLIBBASE__". This define can be useful if
  835. its not desired to have the library base declared extern.
  836.  
  837. Using the new proto headers has some advantages then using the clib and inline
  838. files by itself:
  839.  
  840.     (1) better compatibility with SAS/C. It should be much easier to compile
  841.         programs developed for SAS/C with gcc - almost ;) no need to adjust
  842.         includes
  843.     (2) almost ;) optimal code because depending on the optimization level
  844.         the best suited include set will be used
  845.     (3) internal compiler specific requirements are hidden from the user
  846.  
  847. For the exec.library the proto header has one additional goodie: it "implements"
  848. SAS/C "__USE_SYSBASE". Defining this forces to evaluate the absolute address 4
  849. every time the library base for the exec.library is required. In this case no
  850. global library base is necessary but it must be noted that programs compiled with
  851. this option enabled can have performance problems because AbsExecBase is located
  852. in Chip-Memory. Be aware: if using __USE_SYSBASE its *NOT* legal to declare or
  853. define SysBase! If you do so strange things may happen ... Please note that some
  854. function in libamiga.a require a global "SysBase" so that those functions cannot
  855. be used.
  856.  
  857. Some problems still remain but these restrictions come from the inline technique.
  858. Library bases have to be global due to the nature of the inlines. SAS/C, however,
  859. is able to use local variables or structure elements as library bases. In this case
  860. the library bases has to be made global for gcc.
  861.  
  862. inline headers
  863.  
  864. One major advantage of gcc is its ability to integrate simple functions into the
  865. caller. To direct the compiler to inline a function the keyword "inline" in
  866. combination with "static" or "extern" can be used. Previous version of the inlines
  867. used static in the definition. This had the effect that functions compiled to
  868. assembler if optimization is disabled. The new inline headers use extern definitions.
  869. Functions defined inline and extern can be considered as macros. That means the
  870. definition is only used for inlining thus requiring linking with a library containing
  871. stubs.
  872.